home *** CD-ROM | disk | FTP | other *** search
/ Web Star/List Star - Eve…he Ultimate Internet Site / StarNine Internet Pubisher (Web Star and List Star)(StarNine)(1995).iso / Extras / Scripting Solutions / save⁄read 1.3 / Save osax ReadMe 1.3 next >
Encoding:
Text File  |  1995-08-06  |  2.4 KB  |  53 lines  |  [TEXT/ttxt]

  1. PAUTEX jf
  2. 14, av Milton NANCY 83.40.36.80  ----------------- Club dev. de NANCY  1993-1994
  3.  
  4. This script saves AppleScript data to a disk file. This is faster and more useful than passing data indirectly via an editor. In addition, the type and creator of the file can be parameterized. This allows you to save the results of a script and more.
  5.  
  6. The replacement option, if activated (yes), allows you to completely replace the file; if not the string is written at the end of the specified file (mode append).
  7.  
  8. In this case, the erase option controls the file deletion. "erase true" or "with erase" effectively deletes the file; "without erase" does not delete, but overwrites the data; this is useful for completing or replacing the data fork of an application, using the "replacing yes without erase" option.
  9.  
  10. Note: "replacing no" adds the data to the end of the file. 
  11.  
  12. read data
  13. The read command allows you to extract the variables saved in a file. This read function applies to the data fork of a file. It is possible to quickly learn the contents of the data fork of an application. The read lmit is 32,000 bytes here; the results window seems to be limited to 20,000 bytes.
  14.  
  15. For saving and reading data, you should use data type "TEXT"; this type works best. The script is presented in English but the 'aet' resources for the French script are installed and valid, although not tested. 
  16.  
  17. Formulation :
  18. save data data    -- data or variable object to store
  19.     in alias    -- path to file to store in
  20.     [replacing yes/no] -- replace the file (defaut no)
  21.     [type type class] -- type of file (default "TEXT")
  22.     [creator 'sign']    -- creator of file
  23.                             (default "ttst") teachtext
  24.     [erase boolean]    -- with | without erase
  25.     Result: integer    -- error returned from storing
  26.                             (if any)
  27.  
  28. read data of (alias)    -- read a document
  29. read data of file "abc"    -- idem
  30.  
  31.  
  32. exp:
  33.  
  34. set p to 45
  35. save data p in file "LCII:test" type "TEXT" creator "abcd" replacing yes
  36. save data p in file "LCII:file"
  37.  
  38. set x to find document name "Save-osax.c"
  39. read data of x
  40.  
  41. Writing in the data fork of an application 
  42.  
  43. set p to "data from the application"
  44. save data p in file "LCII:application" replacing yes without erase 
  45.  
  46. The "without erase" option avoides deleting the application, of course!! The "replacing no" option as well which appends data to the end. 
  47.  
  48. Have fun!
  49.  
  50. Contact PAUTEX jf
  51. 14, av Milton 54000 nancy    >>>>>>>> e-mail pautex@lpmi.u-nancy.fr <<<<<<<<<
  52.  
  53.